/**  
 * All rights Reserved, Designed By <a href="www.itttq.com" target="_blank">www.itttq.com</a>
 * @date:   2017年7月15日 下午7:34:29
 * @Copyright: 2017 <a href="www.itttq.com" target="_blank">www.itttq.com</a> Inc. All rights reserved. 
 */  
package com.itttq.kb.mapper;

import java.util.List;

import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import com.itttq.kb.model.to.PageParamTo;

public interface BaseMapper <T> {
		 /**
		  * 插入数据
		  * @param bean
		  * @return
		  */
	    @InsertProvider(type = SqlProvider.class, method = "insert")
	    public int insert(T bean);
	    
	    /**
	     * 删除数据，必须有ID
	     * @param id
	     * @param bean
	     * @return
	     */
	    @DeleteProvider(type = SqlProvider.class, method = "delete")
	    public int delete(T bean);
	    
	    /**
	     * 更新数据，必须有ID
	     * @param bean
	     * @return
	     */
	    @UpdateProvider(type = SqlProvider.class, method = "update")
	    public int update(T bean);
	  
	    /**
	     * 根据ID获取数据
	     * @param bean
	     * @return
	     */
	    @SelectProvider(type = SqlProvider.class, method = "findById")
	    public T findById(T bean);
	    
	    /**
	     * 查找数据
	     * @param bean
	     * @param ppt
	     * @return
	     */
	    @SelectProvider(type = SqlProvider.class, method = "find4page")
	    public List<T> find4page(T bean, PageParamTo ppt);
	    
	    /**
	     * 获取记录总数
	     * @param bean
	     * @return
	     */
	    @SelectProvider(type = SqlProvider.class, method = "getCount")
	    public int getCount(T bean);

}
